package cn.fuck;

public class TestIndexOf {
    /**
     * 找出所有toFind的下标
     * @param s 字符串
     * @param toFind 需要寻找的值
     */
    public static void show(String s, String toFind) {
        int index = 0;
        while (index < s.length()) {
            index = s.indexOf(toFind, index);
            if (index == -1) {
                break;
            }
            System.out.println(index);
            index++;
        }
    }
    public static void main(String[] args) {
//        String s = "sdadargrthr";
//        System.out.println(s.indexOf("r", 6));
        show("abcabcabc", "a");
    }
}
